package com.thrift.client.controller;

import com.thrift.client.rpc.thriftcode.Student;
import com.thrift.client.service.RpcStudentService;
import org.apache.thrift.TException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 何锦涛--CodeSleep
 * @since 2022/9/6 21:16
 */
@RestController
public class TestController {

    @Autowired
    public RpcStudentService rpcStudentService;

    // 测试 RPC 调用
    @GetMapping("get")
    public Student getStudeByName(String name) throws TException {
        return rpcStudentService.getStudentByName(name);
    }
}
